<?php
/**
 * 
 * ClientEngage: ClientEngage Visitor Voice (http://www.clientengage.com)
 * Copyright 2012, ClientEngage (http://www.clientengage.com)
 *
 * You must have purchased a valid license from CodeCanyon in order to have 
 * the permission to use this file.
 * 
 * You may only use this file according to the respective licensing terms 
 * you agreed to when purchasing this item on CodeCanyon.
 * 
 * 
 * 
 *
 * @author          ClientEngage <contact@clientengage.com>
 * @copyright       Copyright 2013, ClientEngage (http://www.clientengage.com)
 * @link            http://www.clientengage.com ClientEngage
 * @since           ClientEngage - Visitor Voice v 1.0
 * 
 */
?>
<div class="visitorforms index row">
    <div class="span12">
        <div class="btn-group pull-right">
            <?php
            echo $this->Html->link('<i class="ico-add"></i> ' . __('Create Form'), array('action' => 'add'), array('class' => 'btn btn-primary', 'escape' => false));
            if (isset($this->request->params['named']['archived']) && $this->request->params['named']['archived'] == true)
                echo $this->Html->link('<i class="ico-database_key"></i> ' . __('Show Archived'), Hash::merge($this->request->params['named'], array('archived' => false)), array('class' => 'btn active', 'data-toggle' => 'button', 'escape' => false));
            else
                echo $this->Html->link('<i class="ico-database_key"></i> ' . __('Show Archived'), Hash::merge($this->request->params['named'], array('archived' => true)), array('class' => 'btn', 'data-toggle' => 'button', 'escape' => false));
            ?>
        </div>
        <h2><?php echo __('Visitorforms'); ?></h2>
        <table class="table table-condensed" style="white-space:nowrap;">
            <thead>
                <tr>
                    <th>
                        <?php echo $this->Paginator->sort('title', __('Title')); ?><br/>
                        <?php echo $this->Paginator->sort('slug', __('Url')); ?>
                    </th>
                    <th><?php echo $this->Paginator->sort('description', __('Description')); ?></th>
                    <th><?php echo $this->Paginator->sort('active', __('Active')); ?></th>
                    <th><?php echo $this->Paginator->sort('visitorvoice_count', __('No. of Responses')); ?></th>
                    <th>
                        <?php echo $this->Paginator->sort('created', __('Created')); ?><br/>
                        <?php echo $this->Paginator->sort('modified', __('Modified')); ?>
                    </th>
                    <th class="actions"><?php echo __('Actions'); ?></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($visitorforms as $visitorform): ?>
                    <tr>
                        <td>
                            <?php echo h($visitorform['Visitorform']['title']); ?><br/>
                            <code><?php echo $visitorform['Visitorform']['slug'] . ' ' . $this->Html->link('<i class="ico-link_go"></i>', array('controller' => 'visitorforms', 'action' => 'get', $visitorform['Visitorform']['slug'], 'admin' => false), array('target' => '_blank', 'escape' => false)); ?></code>
                        </td>
                        <td><?php echo $this->Text->truncate($visitorform['Visitorform']['description'], 50); ?>&nbsp;</td>
                        <td><?php echo $this->Layout->boolYesNo($visitorform['Visitorform']['active']); ?>&nbsp;</td>
                        <td class="col_response-count"><?php echo h($visitorform['Visitorform']['visitorvoice_count']); ?>&nbsp;</td>
                        <td>
                            <?php echo $this->Layout->displayTimeDefault($visitorform['Visitorform']['created']); ?><br/>
                            <?php echo $this->Layout->displayTimeDefault($visitorform['Visitorform']['modified']); ?>
                        </td>
                        <td class="actions">
                            <div class="btn-toolbar">
                                <div class="btn-group">
                                    <?php echo $this->Html->link('<i class="ico-chart_curve"></i> ' . __('Statistics'), array('controller' => 'visitorvoices', 'action' => 'statistics', $visitorform['Visitorform']['id']), array('class' => 'btn btn-mini', 'escape' => false)); ?>
                                    <?php echo $this->Html->link('<i class="ico-table"></i> ' . __('Response List'), array('controller' => 'visitorvoices', 'action' => 'responses', $visitorform['Visitorform']['id']), array('class' => 'btn btn-mini', 'escape' => false)); ?>
                                    <?php echo $this->Html->link(__('View / Edit'), array('controller' => 'visitorforms', 'action' => 'view', $visitorform['Visitorform']['id']), array('class' => 'btn btn-mini')); ?>
                                    <?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $visitorform['Visitorform']['id']), array('class' => 'btn btn-danger btn-mini'), __('Are you sure you want to delete "%s"?', $visitorform['Visitorform']['title'])); ?>
                                </div>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <?php
        echo $this->element('common/defaultpagination');
        ?>	
    </div>
</div>

